package org.budo.hbase.jdbc.driver.statement;

import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Connection;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Table;
import org.budo.jdbc.driver.statement.JdbcStatement;

import lombok.extern.slf4j.Slf4j;

/**
 * @author lmw
 */
@Slf4j
public class SelectStatement implements JdbcStatement {
    @Override
    public void execute(PreparedStatement preparedStatement) throws SQLException {
        try {
            String tableName = null;
            Connection connection = null;
            @SuppressWarnings("null")
            Table table = connection.getTable(TableName.valueOf(tableName));
            Scan scan=new Scan();
            ResultScanner resultScanner=table.getScanner(scan);
            for (Result result : resultScanner) {
                log.info("#30 result="+result);
            }
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}